package com.ukao.cashregister.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.RefundRecordBean;
import com.ukao.cashregister.utils.CheckUtils;
import com.ukao.cashregister.utils.MyDateUtils;

import java.util.ArrayList;

import butterknife.BindView;

/**
 * Created by ukaodev on 2017/6/14.
 */

public class RefundRecordAdapter extends CommonAdapter<RefundRecordBean.ListBean> {


    private boolean isRefundRecordEnter;

    public RefundRecordAdapter(Context context, ArrayList<RefundRecordBean.ListBean> datas) {
        super(context, datas, R.layout.adapter_refund_record);
    }

    public   void  setRefundRecordEnter(boolean  isRefundRecordEnter){
        this.isRefundRecordEnter=isRefundRecordEnter;


    };


    @Override
    public void convert(ViewHolder holder, RefundRecordBean.ListBean item) {
        TextView seq = holder.getView(R.id.seq);
        TextView refundMethodText = holder.getView(R.id.refundMethodText);
        TextView statusText = holder.getView(R.id.statusText);
        TextView tradeTime = holder.getView(R.id.tradeTime);
        TextView amount = holder.getView(R.id.amount);



        seq.setText("退款流水号："+CheckUtils.isEmptyString(item.getSeq()));
        tradeTime.setText(isRefundRecordEnter?MyDateUtils.formatDataTime(item.getTradeTime()):MyDateUtils.formatDataTime(item.getCreateTime()));
        amount.setText("￥"+CheckUtils.isEmptyNumber(item.getAmount()));
        statusText.setTextColor(item.getStatus() == 1 ? mContext.getResources().getColor(R.color.green) : mContext.getResources().getColor(R.color.card_red));
        if (!isRefundRecordEnter){
     /*审核进入*/
            statusText.setText(CheckUtils.isEmptyString(item.getAuditStatusText()));
        }else{
            statusText.setText(item.getStatusText());
            refundMethodText.setText(CheckUtils.isEmptyString(item.getRefundMethodText()));
        }




    }


}
